package com.chenl.provider.DEMOS.接入第三方.DingDing;

import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * https://open.dingtalk.com/document/robots/custom-robot-access
 */
@RestController
@RequestMapping("/ding")
public class DingController {
    @Autowired
    SendDingUtil sendDingUtil;

    @PostMapping("/test")
    public String test(@RequestBody JSONObject jsonObject) throws Exception {
        String msg = jsonObject.getString("msg");
        String res = sendDingUtil.sendDingMsg(msg);
        String res2 = sendDingUtil.sendDingMsg2(msg);
        return res+"------"+res2;
    }
}
